The line-up functions here are the odds and ends which didn't fit into any earlier category.
This lineup function makes the line stay at whatever indentation it already has; think of it as an identity function for lineups.
Works with: Any syntactic symbol.
Line up macro continuation lines according to the indentation of the construct preceding the macro. E.g:
const char msg[] = <- The beginning of the preceding construct. \"Some text.\"; #define X(A, B) \ do { \ <- c-lineup-cpp-define printf (A, B); \ } while (0)and:
int dribble() { if (!running) <- The beginning of the preceding construct. error(\"Not running!\"); #define X(A, B) \ do { \ <- c-lineup-cpp-define printf (A, B); \ } while (0)If
c-syntactic-indentation-in-macrosis non-nil, the function returns the relative indentation to the macro start line to allow accumulation with other offsets. E.g. in the following cases,cpp-define-introis combined with thestatement-block-introthat comes from the ‘do {’ that hangs on the ‘#define’ line:const char msg[] = \"Some text.\"; #define X(A, B) do { \ printf (A, B); \ <- c-lineup-cpp-define this->refs++; \ } while (0) <- c-lineup-cpp-defineand:
int dribble() { if (!running) error(\"Not running!\"); #define X(A, B) do { \ printf (A, B); \ <- c-lineup-cpp-define this->refs++; \ } while (0) <- c-lineup-cpp-defineThe relative indentation returned by
c-lineup-cpp-defineis zero and two, respectively, on the two lines in each of these examples. They are then added to the two column indentation thatstatement-block-introgives in both cases here.If the relative indentation is zero, then
nilis returned instead. That is useful in a list expression to specify the default indentation on the top level.If
c-syntactic-indentation-in-macrosisnilthen this function keeps the current indentation, except for empty lines (ignoring the ending backslash) where it takes the indentation from the closest preceding nonempty line in the macro. If there's no such line in the macro then the indentation is taken from the construct preceding it, as described above.Works with:
cpp-define-intro.
Line up a gcc asm register under one on a previous line.
asm ("foo %1, %0\n" "bar %0, %1" : "=r" (w), "=r" (x) : "0" (y), "1" (z));The ‘x’ line is aligned to the text after the ‘:’ on the ‘w’ line, and similarly ‘z’ under ‘y’.
This is done only in an ‘asm’ or ‘__asm__’ block, and only to those lines mentioned. Anywhere else
nilis returned. The usual arrangement is to have this routine as an extra feature at the start of arglist lineups, e.g.(c-lineup-gcc-asm-reg c-lineup-arglist)Works with:
arglist-cont,arglist-cont-nonempty.
Line up declaration continuation lines zero or one indentation step1. For lines preceding a definition, zero is used. For other lines,
c-basic-offsetis added to the indentation. E.g:int neg (int i) <- c-lineup-topmost-intro-cont { return -i; }and
struct larch <- c-lineup-topmost-intro-cont { double height; } the_larch, <- c-lineup-topmost-intro-cont another_larch; <- c-lineup-topmost-intro-cont <--> c-basic-offsetand
struct larch the_larch, <- c-lineup-topmost-intro-cont another_larch; <- c-lineup-topmost-intro-contWorks with:
topmost-intro-cont.
[1] This function is mainly provided to mimic
the behavior of CC Mode 5.28 and earlier where this case wasn't
handled consistently so that those lines could be analyzed as
either topmost-intro-cont or statement-cont. It's used for
topmost-intro-cont by default, but you might
consider using + instead.